﻿<Window x:Class="SmartText.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:my="clr-namespace:FileSelector;assembly=FileSelector"
        xmlns:local="clr-namespace:SmartText" Title="Smart Text" MinWidth="500"
        MinHeight="300" ResizeMode="CanResizeWithGrip" Closing="Window_Closing"
        Icon="/SmartText;component/st.ico" Loaded="Window_Loaded">
    <Grid x:Name="grid" Validation.Error="grid_Error"
            Grid.IsSharedSizeScope="True">
        <Grid.BindingGroup>
            <BindingGroup x:Name="fileBindingGroup"
                    NotifyOnValidationError="True">
                <BindingGroup.ValidationRules>
                    <local:ValidSelectedFileRule ValidationStep="CommittedValue" />
                </BindingGroup.ValidationRules>
            </BindingGroup>
        </Grid.BindingGroup>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <GroupBox Header="{DynamicResource input}">
            <StackPanel>
                <my:FileSelector Margin="3" x:Name="fsTemplate"
                        LabelText="{DynamicResource template_file}"
                        ButtonText="{DynamicResource template_file_browse}"
                        FileFilter="{DynamicResource template_file_filter}"
                        FileName="{Binding Path=Template, Mode=TwoWay}" />
                <my:FileSelector Margin="3" x:Name="fsParam"
                        LabelText="{DynamicResource parameter_file}"
                        ButtonText="{DynamicResource parameter_file_browse}"
                        FileFilter="{DynamicResource parameter_file_filter}"
                        FileName="{Binding Path=Param, Mode=TwoWay}" />
            </StackPanel>
        </GroupBox>
        <GroupBox Grid.Row="1" Header="{DynamicResource output}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition SharedSizeGroup="fsLabel" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <my:FileSelector Margin="3" Grid.Row="0" Grid.ColumnSpan="2"
                        x:Name="fsOutput"
                        LabelText="{DynamicResource output_file}"
                        ButtonText="{DynamicResource output_file_browse}"
                        FileFilter="{DynamicResource output_file_filter}"
                        FileDialogType="SaveFileDialog"
                        FileName="{Binding Path=Output,Mode=TwoWay}" />
                <TextBlock Grid.Row="1" Margin="6,3,0,3" FontWeight="Bold"
                        HorizontalAlignment="Right"
                        Text="{DynamicResource output_text}"></TextBlock>
                <TextBox Grid.Row="1" Grid.Column="1" Margin="6"
                        TextWrapping="WrapWithOverflow"
                        VerticalScrollBarVisibility="Auto"
                        FontFamily="Courier New" FontSize="14"
                        x:Name="txtOutputText" IsReadOnly="True"
                        Text="{Binding Path=OutputText, Mode=TwoWay}"
                        Background="LightGray" />
            </Grid>
        </GroupBox>
        <!--<GroupBox Grid.Row="2">-->
        <Grid Grid.Row="2" Background="{StaticResource ControlBackgroundBrush}">
            <StackPanel Orientation="Horizontal">
                <Button Margin="8" Padding="20" HorizontalAlignment="Left"
                        Click="btnOption_Click" x:Name="btnOption"
                        Content="{DynamicResource setting}"></Button>
                <Button Margin="8" Padding="20" HorizontalAlignment="Left"
                        Click="btnAbout_Click" x:Name="btnAbout"
                        Content="{DynamicResource about}"></Button>
            </StackPanel>
            <Button Margin="8" Padding="20" HorizontalAlignment="Right"
                    x:Name="btnGenerate" Click="btnGenerate_Click"
                    Content="{DynamicResource generate}"></Button>
        </Grid>
    </Grid>
</Window>